<template>
  <footer class="footer">
    <span class="todo-count"
      >剩余<strong>{{ list.length }}</strong></span
    >
    <ul @click="changeSel" class="filters">
      <li>
        <a
          @click="isAll = 'all'"
          :class="{ selected: isAll === 'all' }"
          href="javascript:;"
          >全部</a
        >
      </li>
      <li>
        <a
          @click="isAll = 'no'"
          :class="{ selected: isAll === 'no' }"
          href="javascript:;"
          >未完成</a
        >
      </li>
      <li>
        <a
          @click="isAll = 'yes'"
          :class="{ selected: isAll === 'yes' }"
          href="javascript:;"
          >已完成</a
        >
      </li>
    </ul>
    <button @click="clearClick" class="clear-completed">清除已完成</button>
  </footer>
</template>

<script>
export default {
  props: ["list"],
  data() {
    return {
      //  all  yes  no
      isAll: "all",
    };
  },
  methods: {
    changeSel() {
      this.$emit("changeTack", this.isAll);
    },
    clearClick() {
      this.$emit("clearTack");
    },
  },
};
</script>